import React, { Component } from "react";
import ReactDOM from "react-dom";
class main extends Component {
  constructor(props) {
    super(props);
    this.state = {
      msg: "",
    };
  }
  // 判断登录用户
  componentWillMount() {
    let user = JSON.parse(localStorage.getItem("user"));
    if (!user) {
      this.setState({
        msg: "欢迎来到SonghanUI",
      });
    } else {
      if (user[0].role == "平民") {
        this.setState({
          msg: "欢迎来到SonghanUI",
        });
      } else {
        this.setState({
          msg: "欢迎来到SonghanUI后台",
        });
      }
    }
  }
  render() {
    return (
      <div className="main">
        <h3>{this.state.msg}</h3>
      </div>
    );
  }
}
export default main;
